import request from '@/utils/request'

// 发送邮箱验证码
export const sendCodeService = (userEmail) => request.post('/user/sendcode', { userEmail })
// 注册
export const regUserService = (userEmail, password) => request.post('/user/register', { userEmail, password })

// 登录
export const loginService = (userEmail, password, role) => request.post('/user/login', { userEmail, password, role })

// 维修员注册申请
export const maintainerRegService = (data) => request.post('/user/maintainerreg', data)

// 查看所有师傅的介绍
export const getAllMasterService = () => request.get('/user/getallmaintainers')

// 获取用户信息
export const getUserInfoService = () => request.get('/api/info')

// 上传用户头像
export const uploadAvatarService = (avatar) => request.post('/api/avatar', { avatar })

// 修改用户信息
export const updateInfoService = (infoObj) => request.post('/api/info', infoObj)

// 修改密码
export const updatePwdService = (oldPwd, newPwd) => request.post('/api/changepwd', { oldPwd, newPwd })

// 获取地址
export const getAddressService = () => request.get('/api/address')

// 添加地址
export const addAddressService = (addressObj) => request.post('/api/addaddress', addressObj)
// 删除地址
export const deleteAddressService = (id) => request.post('/api/deleteaddress', { id })
// 修改地址
export const updateAddressService = (addressObj) => request.post('/api/updateaddress', addressObj)
